import java.util.Random;
import java.util.Scanner;

public class Main {
    //获取一个数二进制序列中所有的偶数位和奇数位， 分别输出二进制序列
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int a = scn.nextInt();
        long odd = 0, even = 0;
        //将二进制序列中所有的偶数位和奇数位逆序存储
        for (int i = 1; i <= 16; i++) {
            if((i % 2) == 0) {
                even = even * 10 + (a % 2);
            } else {
                odd = odd * 10 +(a % 2);
            }
            a /= 2;
        }
        for (int i = 0; i < 8; i++) {
            System.out.print( (even % 10) +" " );
            even /= 10;
        }
        System.out.println(   );
        for (int i = 0; i < 8; i++) {
            System.out.print( (odd % 10) +" " );
            odd /= 10;
        }
    }
    //编写代码模拟三次密码输入的场景。
    // 最多能输入三次密码，密码正确，提示“登录成功”,密码错误， 可以重新输 入，最多输入三次。三次均错，则提示退出程序
    public static void main8(String[] args) {
        Scanner scn =new Scanner(System.in);
        String str2 = scn.nextLine();
        String str1 = "123";
        int i = 1;
        while( i <= 3) {
            if(str1.equals(str2)) {
                System.out.println("登录成功");
                break;
            }
            i++;
        }
        System.out.println("没机会了");
    }
    //输出一个整数的每一位，如：123的每一位是3，2，1
    public static void main7(String[] args) {
        Scanner scn = new Scanner(System.in);
        int a = scn.nextInt();
        while (a != 0) {
            System.out.printf("%d, ", (a % 10));
            a /= 10;
        }
    }
    //输出n*n的乘法口诀表，n由用户输入。
    public static void main6(String[] args) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <=i ; j++) {
                System.out.printf("%2d*%2d = %3d  ", j, i, j*i);
            }
            System.out.printf("\n");
        }
    }
    public static void main5(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            for(int i = 1; i <= n; i++) {
                for(int j = 1; j <= n; j++) {
                    if(j == i || j + i == n+1) {
                        System.out.print("*");
                    }else {
                        System.out.print(" ");
                    }
                }
                System.out.printf("\n");

            }
        }
    }
    //完成猜数字游戏   ，用户输入数字，判断该数字是大于，小于，还是等于随机生成的数字，等于的时候退出程序。
    public static void main4(String[] args) {
        Scanner scn = new Scanner(System.in);
        Random random = new Random();
        int randomNumber = random.nextInt(100);
        while(scn.hasNext()) {
            int a = scn.nextInt();
            if(a > randomNumber) {
                System.out.println("大了");
            } else if (a < randomNumber) {
                System.out.println("小了");
            } else {
                System.out.println("猜对了");
                break;
            }
        }
    }
    //求出0～n之间的所有“水仙花数”并输出。
    // (“水仙花数”是指一个三位数，其各位数字的立方和确好等于该数本 身，如；153＝1^3＋5^3＋3^3，则153是一个“水仙花数“。）
    public static void main3(String[] args) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        for (int i = 1; i <= n ; i++) {
            int temp = i;
            int flag = 0;
            while (temp % 10 != 0) {
                flag++;
                temp /= 10;
            }//判断位数
            int sum = 0;
            int c = i;
            for (int j = 1; j <= flag; j++) {
               sum += Math.pow(c % 10,flag);
               c /= 10;
            }
            if(sum == i) {
                System.out.println(i);
            }
        }
    }
    //计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值
    public static void main2(String[] args) {
        int flag = -1;
        double sum = 0.0;
        for(int i = 1; i <= 100; i++) {
            flag *= (-1);
            sum += flag *(1.0 / i);
        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {
        //求2个整数的最大公约数
        Scanner scn = new Scanner(System.in);
        int a = scn.nextInt();
        int b = scn.nextInt();
        while(a % b != 0) {
            int temp = b;
            b = a % b;
            a = temp;
        }
        System.out.println(b);
    }
}